package com.konyo.service.impl;

import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.konyo.entity.AliyunSmsConf;
import com.konyo.service.AliyunSmsService;
import com.konyo.util.AliyunSmsUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class AliyunSmsServiceImpl implements AliyunSmsService {

    // TODO 此处需要替换成开发者自己的AK(在阿里云访问控制台寻找)
    @Value("${aliyun.accessKeyId}")
    private String accessKeyId ; // TODO 修改成自己的accessKeyId
    @Value("${aliyun.accessKeySecret}")
    private String accessKeySecret; // TODO 修改成自己的accessKeySecret

    @Override
    public SendSmsResponse sendSms(AliyunSmsConf aliyunSmsConf) {
        SendSmsResponse sendSmsResponse = AliyunSmsUtils.sendSms(aliyunSmsConf.getTelephone(), aliyunSmsConf.getContent(), aliyunSmsConf.getSignName(), aliyunSmsConf.getTemplateCode(),accessKeyId,accessKeySecret);
        return sendSmsResponse;
    }
}
